package hz.mobileproject.pda.toolsmanager.adapter;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.blankj.utilcode.util.TimeUtils;

import org.xutils.view.annotation.ViewInject;

import java.util.Date;
import java.util.List;

import hz.mobileproject.pda.R;
import hz.mobileproject.pda.toolsmanager.bean.response.RP_WaiJie_GuiHuan;
import hz.mobileproject.pda.ui.base.BaseCustomAdapter;

/**
 * Created by Lc on 2018/1/30.
 */

public class WaiJieAndGuiHuanAdapter extends BaseCustomAdapter<RP_WaiJie_GuiHuan,WaiJieAndGuiHuanAdapter.SearchVH> {


    private final boolean isWaiJie;

    public WaiJieAndGuiHuanAdapter(Context mContext, List<RP_WaiJie_GuiHuan> list, boolean isWaiJie) {
        super(mContext, list);
        this.isWaiJie = isWaiJie;
    }

    @Override
    protected int bindView() {
        return R.layout.item_waijie_guihuan_lv;
    }

    @Override
    protected SearchVH createViewHolder() {
        return new SearchVH();
    }

    @Override
    protected void bindData(int position, View convertView, SearchVH vh) {
        RP_WaiJie_GuiHuan bean = mList.get(position);
        vh.tv_jiechu_dept.setText(bean.out_dprt_name);
        vh.tv_jiechu_person.setText(bean.out_person_name);
        vh.tv_jieyong_dept.setText(bean.in_dprt_name);
        vh.tv_jieyong_person.setText(bean.in_person_name);
        vh.tv_tool_bh.setText(bean.tool_id);
        vh.tv_tool_name.setText(bean.tool_name);
//        vh.tv_too_lx.setText(bean.tool_type);

        vh.tv_jeichu_time.setText( TimeUtils.date2String(new Date(Long.parseLong(bean.borrow_time))));
        vh.tv_guihuan_person.setText(bean.return_person_name);
        vh.tv_jieshou_person.setText(bean.receive_person_name);
        vh.tv_guihuan_time.setText( TimeUtils.date2String(new Date(Long.parseLong(bean.return_time))));

    }

    class SearchVH{
        @ViewInject(R.id.tv_jiechu_dept)
        private TextView tv_jiechu_dept;
        @ViewInject(R.id.tv_jiechu_person)
        private TextView tv_jiechu_person;
        @ViewInject(R.id.tv_jieyong_dept)
        private TextView tv_jieyong_dept;
        @ViewInject(R.id.tv_jieyong_person)
        private TextView tv_jieyong_person;
        @ViewInject(R.id.tv_tool_bh)
        private TextView tv_tool_bh;
        @ViewInject(R.id.tv_tool_name)
        private TextView tv_tool_name;
        @ViewInject(R.id.tv_too_lx)
        private TextView tv_too_lx;
        @ViewInject(R.id.tv_jeichu_time)
        private TextView tv_jeichu_time;
        @ViewInject(R.id.tv_guihuan_person)
        private TextView tv_guihuan_person;
        @ViewInject(R.id.tv_jieshou_person)
        private TextView tv_jieshou_person;
        @ViewInject(R.id.tv_guihuan_time)
        private TextView tv_guihuan_time;



    }
}
